{include file="admin/top.php" subject='supplieProducts'}
{include file="supplieProducts/top.php" subject='supplieProducts'}
<div id="content">
  <form method="post">
    <table width="100%" border="0" cellpadding="5" cellspacing="0" id="editor">
        <tr>
        <td class="title">产品供应商:<br/><br/><select name="shopid" onchange="$('[shopid]').hide();$('[shopid='+this.value+']').show();">{shops}<option value="{$shops.id}" {if $shops.id==$products.shopid}selected{/if} {if 1==$shops.disabled}disabled{/if}>{$shops.title}</option>{/shops}</select></td>
        <td class="content">
        	<select name="supplier" size="10" style="height: auto;">
        		{foreach from=$suppliers item=item}
        			<option value="{$item.id}" {if $item.id == $smarty.post.supplier}selected{/if} shopid="{$item.shopid}" style="{if $products.shopid>0 and $products.shopid!=$item.shopid}display:none;{else}{/if}">{$item.title}</option>
        		{/foreach}
        	</select>
        </td>
        <td class="content"> {if $errors.empty_supplier}<span class="warning">请指定供应商</span>
        {else}指定供应商
        {/if}</td>
      </tr>
      <tr>
        <td class="title">产品名称: *</td>
        <td class="content"><input name="product" type="text" id="product" value="{$smarty.post.product|default:$smarty.get.pid}" size="30" onclick="select()"
        onkeyup="context_menu_products(this, 'productid=[product_sku_id],product=[title],spec=[spec],unit=[unit],pricebuy=[pricebuy]')"
        onfocus="context_menu_products(this, 'productid=[product_sku_id],product=[title],spec=[spec],unit=[unit],pricebuy=[pricebuy]')" />
        </td>
        <td class="content">
        {if $errors.empty_product}<span class="warning">产品名称不能为空</span>
        {elseif $errors.unexist_product}<span class="warning">产品数据中找不到该产品</span>
        {else}在此输入/选择产品编号后产品信息会自动填写
        {/if}
        </td>
      </tr>
      <tr style="display:none;">
        <td class="title">产品ID:</td>
        <td class="content"><input name="productid" type="text" id="productid" value="{$smarty.post.productid}" size="30"/></td>
        <td class="content">&nbsp;</td>
      </tr>
      <tr>
        <td class="title">产品规格:</td>
        <td class="content"><input name="spec" type="text" id="spec" value="{$smarty.post.spec}" size="30" readonly="true"/></td>
        <td class="content">例如：50ml,200g,5kg,0.5g×20 等</td>
      </tr>
      <tr>
        <td class="title">采购单价:</td>
        <td class="content">
        	<input name="pricebuy" type="text" id="pricebuy" value="{$smarty.post.pricebuy}" size="30"/>
        	<select name="currency_unit">
        		<option value="">---请选择---</option>
        		{foreach from=$currency_unit_arr item=culist}
        		<option value="{$culist.unit_en}" {if $smarty.post.currency_unit==$culist.unit_en}selected{/if}>{$culist.unit_name}</option>
        		{/foreach}
        	</select>
        	 *
        </td>
        <td class="content">{if $errors.empty_pricebuy}<span class="warning">采购单价不能为空</span>
        {elseif $errors.empty_currency_unit}<span class="warning">货币单位不能为空</span>
        {else}填写采购单价<span class="warning">(请选择正确的货币单位)</span>
        {/if} </td>
      </tr>
      <tr>
        <td class="title">供应商库存:</td>
        <td class="content"><input name="stock" type="text" id="stock" value="{$smarty.post.stock|default:0}" size="30" /> </td>
        <td class="content">允许销售的库存数</td>
      </tr>
      <tr>
        <td class="title">供应商最大库存:</td>
        <td class="content"><input name="stock_base" type="text" id="stock_base" value="{$smarty.post.stock_base|default:0}" size="30" /> </td>
        <td class="content">允许销售的最大库存数</td>
      </tr>
      <tr class="noline">
      	<td class="title">供应商产品编号:</td>
      	<td class="content"><input name="sbarcode" type="text" id="sbarcode" value="{$smarty.post.sbarcode}" size="30"/></td>
        <td class="content">
         	填写产品编号, 如 4711161741799等
		</td>
      </tr>
      <tr>
      	<td class="title">状态:</td>
        <td class="content">
        	<input name="status" type="radio" id="status" value="-3" {if $smarty.post.status==-3}checked{/if}/>下架
        	<input name="status" type="radio" id="status" value="1" {if $smarty.post.status==1 or !$smarty.post.status}checked{/if}/>上架
    	</td>
        <td class="content">&nbsp;</td>
      </tr>
      <tr>
      	<td class="title">是否默认:</td>
        <td class="content">
        	<input name="is_default" type="radio" id="is_default" value="0" {if $smarty.post.is_default==0}checked{/if}/>否
        	<input name="is_default" type="radio" id="is_default" value="1" {if $smarty.post.is_default==1}checked{/if}/>是
    	</td>
        <td class="content">&nbsp;</td>
      </tr>
    </table>
    
    <div class="fr mt10">
    <input type="submit" value="确定" class="btn" />
    <a href="javascript:window.history.go(-1);" class="btn">取消</a> 
    <input name="referer" type="hidden" id="referer" value="{$smarty.post.referer|default:$smarty.server.HTTP_REFERER:1}" />
    <input name="action" type="hidden" id="action" value="create" />
    </div>
	
  </form>
</div>
{include file="admin/bottom.php"}
</body>
</html>
